package shy.mapper;

import org.apache.ibatis.annotations.*;
import shy.bean.Adoptive;
import shy.bean.Animal;

import java.util.List;

@Mapper

public interface AnimalMapper {
    @Select("select*from wams_animal where state=0")
    List<Animal> findAllAnimal();
    @Select("SELECT * FROM wams_animal WHERE state = 0 AND gender = #{gender} AND animalName LIKE #{animalName} AND health = #{health} ")
    List<Animal> findAnimalGetBy(@Param("gender") int gender, @Param("animalName") String animalName, @Param("health") String health, @Param("begin") int begin, @Param("size") int size);
    //删除指定动物
    @Update("update wams_animal  set state = 1 where id =#{id} ")
    int deleteAnimalById(int id);
    //添加动物
    @Insert("insert into wams_animal(id,animalCode,animalName,type,health,gender,birthday,state)" +
            "values(null,#{animalCode},#{animalName},#{type},#{health},#{gender},#{birthday},0)")
    int saveAnimal(Animal animal);
    @Update("update wams_animal set animalCode=#{animalCode},animalName=#{animalName},type=#{type},gender=#{gender},health=#{health},birthday=#{birthday},state=#{state} where id = #{id}")
    int updateAnimal(Animal animal);
}
